package cn.baiweigang.uu.enums;

public enum TradeStatusEnum {

    INIT(1, "未生效"),
    Wait_Trigger(2, "等待委托"),
    SUBMITED(3, "已提交"),
    PART_DEAL(4, "部分成交"),
    PART_DEAL_OTHER_CANCEL(5, "部分成交已撤单"),
    ALL_DEAL(6, "全部成交"),
    CANCEL(7, "已撤单"),
    CANCEL_PROCESSING(11, "撤单中"),
    ;

    private Integer code;
    private String desc;

    TradeStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static TradeStatusEnum byCode(Integer code) {
        TradeStatusEnum[] tradeStatusEnums = TradeStatusEnum.values();
        for (int i = 0; i < tradeStatusEnums.length; i++) {
            if (tradeStatusEnums[i].getCode() == code) {
                return tradeStatusEnums[i];
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
